﻿using Abp.Domain.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using Toolbelt.ComponentModel.DataAnnotations.Schema;

namespace HCD.Entities
{
    [Table("MDT_ORDER")]
    public class MdtOrder : Entity<long>
    {
        /// <summary>
        /// 病人标识
        /// </summary>
        [Required,Column("PATIENT_ID", TypeName = "VARCHAR(20)"),Index("IXU_MDT_ORDER", 1,IsUnique =true)]
        public string PatientId { get; set; }

        /// <summary>
        /// 就诊标识
        /// </summary>
        [Required, Column("VISIT_ID", TypeName = "VARCHAR(20)"), Index("IXU_MDT_ORDER", 2, IsUnique = true)]
        public string VisitId { get; set; }

        /// <summary>
        /// 会诊ID
        /// </summary>
        [Column("MDT_ID", TypeName = "BIGINT"), Index("IXU_MDT_ORDER", 3, IsUnique = true)]
        public long MdtId { get; set; }

        /// <summary>
        /// 医嘱号
        /// </summary>
        [Column("ORDER_NO", TypeName = "INT"),Index("IXU_MDT_ORDER", 4, IsUnique = true)]
        public int OrderNo { get; set; }

        /// <summary>
        /// 子医嘱序号
        /// </summary>
        [Column("ORDER_SUB_NO", TypeName = "INT"), Index("IXU_MDT_ORDER", 5, IsUnique = true)]
        public int OrderSubNo { get; set; }

        /// <summary>
        /// 模版类型（处方/医嘱）
        /// </summary>
        [Column("TEMPLATE_TYPE", TypeName = "INT")]
        public int TemplateType { get; set; }

        /// <summary>
        /// 医嘱类别
        /// </summary>
        [Column("ORDER_CLASS", TypeName = "VARCHAR(60)")]
        public string OrderClass { get; set; }

        /// <summary>
        /// 药品类型
        /// </summary>
        [Column("DRUG_CLASS", TypeName = "VARCHAR(60)")]
        public string DrugClass { get; set; }

        /// <summary>
        /// 长临
        /// </summary>
        [Column("REPEAT_INDICATOR", TypeName = "VARCHAR(60)")]
        public string RepeatIndicator { get; set; }

        /// <summary>
        /// 医嘱正文
        /// </summary>
        [Column("ORDER_TEXT", TypeName = "VARCHAR(60)")]
        public string OrderText { get; set; }

        /// <summary>
        /// 医嘱代码
        /// </summary>
        [Column("ORDER_CODE", TypeName = "VARCHAR(60)")]
        public string OrderCode { get; set; }

        /// <summary>
        /// 项目
        /// </summary>
        [Column("SPEC", TypeName = "VARCHAR(60)")]
        public string Spec { get; set; }

        /// <summary>
        /// 药品单次使用剂量/数量（处方）
        /// </summary>
        [Column("DOSAGE", TypeName = "DECIMAL")]
        public decimal Dosage { get; set; }

        /// <summary>
        /// 用量单位/数量单位（处方）
        /// </summary>
        [Column("DOSAGE_UNITS", TypeName = "VARCHAR(8)")]
        public string DosageUnits { get; set; }

        /// <summary>
        /// 药品厂家
        /// </summary>
        [Column("FIRM_ID", TypeName = "VARCHAR(30)")]
        public string FirmId { get; set; }

        /// <summary>
        /// 频次
        /// </summary>
        [Column("FREQUENCY", TypeName = "VARCHAR(16)")]
        public string Frequency { get; set; }

        /// <summary>
        /// 途径
        /// </summary>
        [Column("ADMINISTRATION", TypeName = "VARCHAR(16)")]
        public string Administration { get; set; }

        /// <summary>
        /// 疗程（处方）
        /// </summary>
        [Column("DURATION", TypeName = "INT")]
        public int Duration { get; set; }

        /// <summary>
        /// 疗程单位
        /// </summary>
        [Column("DURATION_UNITS", TypeName = "VARCHAR(4)")]
        public string DurationUnits { get; set; }

        /// <summary>
        /// 医生说明
        /// </summary>
        [Column("FREQ_DETAIL", TypeName = "VARCHAR(80)")]
        public string FreqDetail { get; set; }

        /// <summary>
        /// 检验/检查子类
        /// </summary>
        [Column("SUB_CLASS", TypeName = "VARCHAR(60)")]
        public string SubClass { get; set; }

        /// <summary>
        /// 检查目的
        /// </summary>
        [Column("EXAM_REASON", TypeName = "VARCHAR(60)")]
        public string ExamReason { get; set; }

        /// <summary>
        /// 检查部位
        /// </summary>
        [Column("EXAMEPART", TypeName = "VARCHAR(60)")]
        public string Examepart { get; set; }

        /// <summary>
        /// 检验标本
        /// </summary>
        [Column("SPECIMEN", TypeName = "VARCHAR(60)")]
        public string Specimen { get; set; }

        /// <summary>
        /// 执行状态
        /// </summary>
        [Column("PERFORM_STATUS", TypeName = "VARCHAR(60)")]
        public string PerformStatus { get; set; }

        /// <summary>
        /// 执行医嘱流水号
        /// </summary>
        [Column("PERFORM_ORDER_NO", TypeName = "VARCHAR(60)")]
        public string PerformOrderNo { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [Column("CREATED_BY", TypeName = "VARCHAR(2)")]
        public string CreatedBy { get; set; }

        /// <summary>
        /// 创建人姓名
        /// </summary>
        [Column("CREATED_BY_NAME", TypeName = "VARCHAR(60)")]
        public string CreatedByName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("CREATED_TIME", TypeName = "DATETIME")]
        public DateTime CreatedTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        [Column("UPDATED_TIME", TypeName = "TIMESTAMP(3)"),ConcurrencyCheck]
        public DateTime UpdatedTime { get; set; }
    }
}
